﻿<%@ Page Title="" Language="C#" MasterPageFile="~/admin/admin.Master" AutoEventWireup="true"
    CodeBehind="ProductTypeList.aspx.cs" Inherits="TransFormer.Web.admin.ProductTypeList" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script type="text/javascript">
        $(function () {
            $('#dg').datagrid({
                url: 'AdminAshx/ProductTypeList.ashx',
                title: '产品目录管理',
                fitColumns: true,
                idField: 'Id',
                loadMsg: '正在加载用户的信息...',
                pagination: true,
                singleSelect: false,
                pageSize: 10,
                pageNumber: 1,
                pageList: [10, 20, 30],
                queryParams: {},
                columns: [[
                    { field: 'ck', checkbox: true, align: 'left', width: 50 },
                    { field: 'Id', title: 'ID' },
                    { field: 'TypeName', title: '目录名' },
                    { field: 'TypeDesc', title: '类型描述' },
                    { field: 'ParrentId', title: '父节点ID' },
                    { field: 'ParentName', title: '父节点名称' },
                    { field: 'Language', title: '网站语言' }
                ]],
                toolbar: [{
                    id: 'btnAdd',
                    text: '添加目录',
                    iconCls: 'icon-add',
                    handler: function () {
                        window.location = "producttypeAdd.aspx";
                    }
                }, {
                    id: 'btnRemove',
                    text: '删除目录',
                    iconCls: 'icon-remove',
                    handler: function () {
                        var ids = [];
                        var rows = $('#dg').datagrid('getSelections');
                        if (rows.length == 0) {
                            alert("请选择一条记录");
                            return;
                        }
                        for (var i = 0; i < rows.length; i++) {
                            ids.push(rows[i].Id);
                        }
                        if (!confirm("确定要删除吗？")) return;
                        $.get("adminashx/ProductTypeRemove.ashx", { "ids": ids.join(',') }, function (data) {
                            if (data) {
                                alert("删除成功！！");
                                $('#dg').datagrid('reload');
                            }
                            else {
                                alert("删除失败!");
                            }
                        });

                    }
                }, {
                    id: 'btnEdit',
                    text: '修改目录',
                    iconCls: 'icon-edit',
                    handler: function () {
                        var row = $("#dg").datagrid("getSelected");
                        if (!row)
                            alert("请选择一条记录");
                        else {
                            window.location = "ProductTypeEdit.aspx?Id=" + row.Id;
                        }
                    }
                }
                ],
                onHeaderContextMenu: function (e, field) {

                }
            });
        });
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <table id="dg">
    </table>
</asp:Content>
